<?php
/**
 * base controller's functoin to deal with POST requests
 *
 *
 * @author Ishtiaque Shahrier <md.ishtiaque@newgenbd.net>
 * @package core
 * @subpackage libraries
 */
interface i_handle_posts {
    /**
     * This should be a key i the POST var if you want to render a page partially
     */
    const RENDER_PARTIAL = "do_partial";
    /**
     * This should be a key i the POST var if you want get response as ajax
     */
    const IS_AJAX        = "is_ajax";
    /**
     * HTML field name for sending op_code data
     */
    const OP_CODE = 'op_code';
    /**
     * If returns true then the automatic functiona remapping will be enabled
     * @return bool
     */
    public function is_handling_post_enabled();
     /**
     * Get the current operation name coming from the form hidden field. $_POST['op_name']
     * @return string|NULL
     */
    public function get_op_name();
     /**
     * Saves all POST vars inside an array to post them back.
     * @return array
     */
    public function list_post_vars();
     /**
     * Internal function to call proper function that will process appropiate request.
     * @param string $method
     * @return void
     */
    public function _remap($method);
    /**
     * returns TRUE if the request coming from the client is POST else FALSE
     * @return bool
     */
    public function is_post();
    /**
     * Detects whether to render the entire page or just that view
     * @return bool
     */
    public function do_partial_rendering();

    /**
     * Detects if the request from the client browser is an ajax request
     * @return bool
     */
     public function is_ajax();
}
